<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="com.androidserver.util.DatastoreWrapper"%>
<%@page import="com.google.appengine.api.datastore.Query.FilterOperator"%>
<%@page import="com.google.appengine.api.datastore.FetchOptions"%>
<%@page import="com.google.appengine.api.datastore.Entity"%>
<%@page import="java.util.List"%>
<%@page import="com.google.appengine.api.datastore.Query.SortDirection"%>
<%@page import="com.google.appengine.api.datastore.Query"%>
<%@page import="com.google.appengine.api.datastore.Key"%>
<%@page import="com.google.appengine.api.datastore.KeyFactory"%>
<%@page import="com.google.appengine.api.datastore.DatastoreServiceFactory"%>
<%@page import="com.google.appengine.api.datastore.DatastoreService"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Datastore</title>
</head>
<body>
	<%
	DatastoreWrapper dataWrapper = DatastoreWrapper.getInstance();
	List<Entity> members = dataWrapper.getMembers();
	List<Entity> groups = dataWrapper.getGroups();
	%><u>Kasutajad:</u><br><%
	for (int i = 0; i < members.size(); i++) {		
	%> <%= members.get(i).getProperty("memberName") %> - <%= members.get(i).getProperty("idCode") %><br> <%
	} %><hr><u>Grupid:</u><br><%
	for (int i = 0; i < groups.size(); i++) {
	%> <%= groups.get(i).getProperty("groupName") %><br> <%
		List<Entity> groupMembers = dataWrapper.getGroupMembers(groups.get(i));
		for (int j = 0; j < groupMembers.size(); j++) { %>
		&nbsp;&nbsp;&nbsp;&nbsp;<%= groupMembers.get(j).getProperty("memberName") %>
		 - <%= groupMembers.get(j).getProperty("latitude") %>;
		  <%= groupMembers.get(j).getProperty("longitude") %><br>
		<%	
		}
	}
	%>
</body>
</html>